<?php
class Customer extends Eloquent {
	
	public static $rules = array(
		'code'=>'required',
		'name'=>'required|min:2|unique:customers'
	);
	
	public function isDeletable() {
		return Order::where('customer_id', '=', $this->id)->count() === 0;
	}
}